package com.zxy.zxyrpc.exception;

import com.zxy.zxyrpc.model.ErrorCode;

/**
 * 自定义异常类
 *
 * @author zxy
 * @since 2025/6/15
 **/
public class RpcException extends RuntimeException{
    private final int code;

    public RpcException(int code, String msg){
        super(msg);
        this.code = code;
    }
    public RpcException(ErrorCode errorCode){
        super(errorCode.getMessage());
        this.code = errorCode.getCode();
    }
    public RpcException(ErrorCode errorCode, String msg){
        super(msg);
        this.code = errorCode.getCode();
    }
}
